<template>
		<view id="signupgroup">
		<!-- 	<view class="signup_header">

			</view> -->
				<view class="signup_content">
						<scroll-view scroll-y="true" >
							<view class="group_cell" v-for="(item,index) in groupList" :key='index'>
								<view class="cell_header">
									<view class="">
										{{item.groupname?item.groupname:''}}
									</view>
									<view class="blue" v-show='typeID==1'>
										待审核
									</view>
									<view class="red" v-show='typeID==2'>
										审核未通过
									</view>
									<view class="green" v-show='typeID==3'>
										已通过
									</view>
								</view>
								<view class="cell-content">
									<view class="cells">
										<text>报名时间:</text>{{item.r_begintime.slice(0,16)+"至"+item.r_endtime.slice(0,16)}}
									</view>
									<view class="cells">
										<text>比赛时间:</text>{{item.begintime.slice(0,16)+"至"+item.endtime.slice(0,16)}}
									</view>
									<view class="cell">
										<view class="">
											<text>等级限制:</text>{{item.gradeText?item.gradeText:""}}
										</view>
										<view class="cell_count">
											{{item.costSum}}
										</view>
									</view>
								</view>
							</view>
						</scroll-view>
				</view>
				
			</view>
			
		</view>
</template>

<script>
	import {auditDetail} from "@/common/api.js";
	export default{
		data(){
			return{
				isCheckStep:false, //是否显示审核进度
				id:'',
				groupList:[],
				detail_type:"",
				statusList:[{type:"1",checkStatus:'待审核',status:'isAuditing'},{type:'2',checkStatus:'未通过',status:'isNoAudit'},{type:'3',checkStatus:'已通过',status:'isAudit'}],  //状态
				typeID:""
			}
		},
		onLoad(e){
			var _this=this;
			// console.log(_this.id)
			_this.id=e.id;
			_this.detail_type=_this.statusList.filter(function(item,index){
				return item.type==e.type
			})[0].checkStatus;
			_this.typeID=_this.statusList.filter(function(item,index){
				return item.type==e.type
			})[0].type;
			switch(_this.typeID){
				case '1': return _this.detail_type='未授权';
				case "2": return _this.detail_type="授权未通过";
				case "3": return _this.detail_type="已授权"
			}
		},
		onShow() {
			var _this=this;
			_this.getGroupData()
		},
		methods:{
			back(){
				var _this=this;
				uni.navigateTo({
					url:'/pages/competitionAudit/audit/auditDetail?id='+_this.id+"&typeid="+_this.typeID
				})
			},
			getGroupData(){
				var _this=this,data={
					examine_id:_this.id
				};
				auditDetail(data).then(function(res){
					var e=res.data;
					if(e.errcode==0){
						// _this.authorizedData=e.e
						var list="";
						if(e.group_new){
							list=JSON.parse(e.group_new);
							_this.groupList=list['step1'];
							_this.groupList=_this.feeGetGroup(list['step1'],list["step2"])
						}else if(e.errcode==1000||e.errcode==1001){
							uni.removeStorageSync('token');
							uni.reLaunch({
								url:'/pages/home/welcome'
							})
						}else{	
							list=JSON.parse(e.group_old);
							_this.groupList=list['step1'];
							_this.groupList=_this.feeGetGroup(list['step1'],list["step2"])
						}
					}else{
						uni.showToast({
							position: 'center',
							icon: 'none',
							title: e.msg
						});
					}
				})
			},
			//赛事报名费
			feeGetGroup(step,newStep){
			  const that = this;
			  // var num=''
			  if(step && step.length>0){
			    step.map(function(item,index){
						if(item.cost&&item.cost.length>0){
							item.cost.map(function(items,indexs){
								if(items.costName=="报名费"){
									item.costSum="￥"+items['cost'];
								}else{
									if(newStep){
										item.costSum="￥"+newStep[0]['cost']
									}
								}
							})
						}else{
							if(newStep){
								item.costSum="￥"+newStep[0]['cost']
							}
						}
					})
			  }
				return step;
			}
		}
	}
</script>

<style lang="less" scoped>
	#signupgroup{
		background: #F6F7F9;
		font-size: 14px;
		// height: 100vh;
		.blue{
			color: #2D8DFF;
		}
		.red{
			color: #FF535A;
		}
		.green{
			color: #81D25A;
		}
	}
	.signup_header{
		position: relative;
		padding: 5px 0;
		font-size: 18px;
		text-align: center;
		background: #fff;
		border-bottom: 1px solid #F1F1F2;
		.back{
			position: absolute;
			left: 0;
			top: 0;
		}
	}
	.signup_content{
		margin: 0 16px ;
		// height: 100px;
		// background: red;
		.group_cell{
			min-height: 127px;
			padding: 11px 12px 13px;
			background: #fff;
			margin-top: 14px;
			border-radius: 8px;
			.cell_header{
				// height: 33px;
				// background: green;
				display: flex;
				flex-direction: row;
				justify-content: space-between;
				border-bottom: 1px solid #F1F1F2;
				view:first-child{
					font-size:16px;
					width: 75%;
				}
				view:last-child{
					width: 25%;
					align-self: center;
					text-align: right;
				}
			}
			.cell-content{
				margin-top: 4px;
				color: #8E8E93;
				.cells{
					margin-top: 9px;
					text{
						padding-right: 5px;
					}
				}
				.cell{
					margin-top: 9px;
					display: flex;
					flex-direction: row;
					justify-content: space-between;
					text{
						padding-right: 5px;
					}
				}
				.cell_count{
					font-size: 16px;
					color: #FF6B6B;
				}
			}
		}
	}
</style>
